package com.sinothk.client.user.controller;

import com.sinothk.client.user.entity.UserEntity;
import com.sinothk.server.support.entity.ResultData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

@Api(tags = "角色操作")
@RestController
@RequestMapping("/role")
public class RoleController {

    @ApiOperation(value = "新增角色", notes = "新增角色。。")
    @PostMapping("/add")
    public ResultData<UserEntity> add(@ApiParam(value = "用户名", required = true) @RequestParam("name") String name) {
        UserEntity user = new UserEntity();
        user.setUserName(name);
        return new ResultData<UserEntity>().getSuccess(user);
    }

    @ApiOperation(value = "获取角色", notes = "获取角色。。")
    @GetMapping("/getInfo")
    public ResultData<UserEntity> getInfo() {
        UserEntity user = new UserEntity();
        user.setUserName("sinothk");

        ResultData<UserEntity> resultData = new ResultData<>();
        resultData.setData(user);
        return resultData;
    }
}
